Skip to content

Conversation

@ckyongrtl
Copy link

@ckyongrtl ckyongrtl commented Dec 20, 2019

So there is this feature that we were still missing in our code, which is the possibility to configure settings through the Action pattern (while preserving validation).

So with this we can use services.ConfigureWithValidation(options => DoWhatever(options));

Also includes some refactoring to make the test logic a bit cleaner while supporting some more variable syntax.

@ckyongrtl
Copy link
Author

Just had a discussion with @sfmskywalker regarding the difference between this package and the way this has been incorporated in netcore 3.1 (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-3.1#options-validation).

The main difference is that the MS provided version does the validation at resolve-time. This package on the other hand, does validation during application startup, not allowing for the application to boot at all if it has been misconfigured. You can achieve this with the built-in MS solution, but you'll need a lot more boilerplate (build a serviceprovider, then try to resolve it as a required service). This is also more error-prone, because you need to remember to resolve every service that you want startup time validation on. In my opinion, this package/change does have its merits, and I'd like to make use of the ConfigureWithValidation(Action<T>) syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants